package edu.mtu.citizenscience.cs.notepad.activity.noteslist.note;

import com.androidquery.AQuery;

import edu.mtu.citizenscience.cs.notepad.activity.R;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
 * @author Corbin Uselton <corbinu@cwuselto@mtu.edu>
 * @copyright (c) 2012 MichiganTech <http://www.mtu.edu>
 * @since 1.0
 * 
 * Dialog for asking the user if note changes should be saved
 */
public class SaveDialog extends DialogFragment {
	// android-query library
	private AQuery aq;

	/**
	 * Create view for the save dialog
	 * 
	 * @param inflater - LayoutInflater - for inflating views
	 * @param container - ViewGroup - the dialogs view container
	 * @param savedInstanceState - Bundle - Bundle with launch info
	 * @return View - the View for the fragment's UI, or null
	 */
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) 
    {
    	// inflate the save dialog view
    	View view = inflater.inflate(R.layout.dialog_save, container, false);
    	
    	// create android query instance
    	this.aq = new AQuery(this.getActivity(), view);
    	
    	// set the dialog title
    	this.getDialog().setTitle("Save Note?");
    	
    	// set button handlers for yes and no buttons on the containing activity
    	this.aq.id(R.id.saveYesButton).clicked(this.getActivity(), "saveYesClicked");
    	this.aq.id(R.id.saveNoButton).clicked(this.getActivity(), "saveNoClicked");
    	
    	// return the inflated view
        return view;
    }

}
